From 079532c6569fe7faa5b096547aa5f4cc79b6f00c Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C3=98yvind=20Kol=C3=A5s?= Date: Wed, 31 Aug 2005 14:47:46 +0000 Subject: [PATCH] header cleanout --- ChangeLog | 62 +++++++++++++ babl/Makefile.am | 27 +----- babl/babl-classes.h | 12 +-- babl/babl-component.c | 12 +-- babl/babl-component.h | 28 ------ babl/babl-conversion.c | 44 +++++---- babl/babl-conversion.h | 37 -------- babl/babl-core.c | 13 +-- babl/babl-core.h | 25 ------ babl/babl-db.h | 39 +++----- babl/babl-extension.c | 10 ++- babl/babl-extension.h | 34 ------- babl/babl-fish.c | 118 +++++-------------------- babl/babl-fish.h | 49 ----------- babl/babl-format.c | 5 +- babl/babl-format.h | 28 ------ babl/babl-image.c | 12 +-- babl/babl-image.h | 45 ---------- babl/babl-instance.h | 40 --------- babl/babl-internal.c | 63 +++++++++++++ babl/babl-internal.h | 79 ++++++++++++----- babl/babl-introspect.c | 1 - babl/babl-introspect.h | 28 ------ babl/babl-memory.c | 13 ++- babl/babl-model.c | 2 +- babl/babl-model.h | 28 ------ babl/babl-sampling.c | 4 +- babl/babl-sampling.h | 30 ------- babl/babl-sanity.c | 1 - babl/babl-sanity.h | 25 ------ babl/babl-type.c | 17 ++-- babl/babl-type.h | 26 ------ babl/babl.c | 4 - babl/babl.h | 181 ++++++++++++++++++++++++++++++++++---- babl/base/model-cmyk.c | 14 +-- babl/base/model-gray.c | 40 +++++---- babl/base/model-rgb.c | 25 +++--- babl/base/model-ycbcr.c | 10 ++- babl/base/type-float.c | 10 ++- babl/base/type-u16.c | 22 ++--- babl/base/type-u8.c | 22 ++--- docs/index-static.html.in | 3 +- extensions/CIE-Lab.c | 54 +++++++----- extensions/naive-CMYK.c | 18 ++-- tests/babl-html-dump.c | 3 +- tests/babl_class_name.c | 1 - tests/grayscale_to_rgb.c | 1 - tests/introspect.c | 1 - tests/models.c | 3 +- tests/nop.c | 1 - tests/rgb_to_bgr.c | 1 - tests/rgb_to_ycbcr.c | 1 - tests/sanity.c | 2 - tests/srgb_to_lab_u8.c | 1 - tests/types.c | 3 +- 55 files changed, 574 insertions(+), 804 deletions(-) delete mode 100644 babl/babl-component.h delete mode 100644 babl/babl-conversion.h delete mode 100644 babl/babl-core.h delete mode 100644 babl/babl-extension.h delete mode 100644 babl/babl-fish.h delete mode 100644 babl/babl-format.h delete mode 100644 babl/babl-image.h delete mode 100644 babl/babl-instance.h delete mode 100644 babl/babl-introspect.h delete mode 100644 babl/babl-model.h delete mode 100644 babl/babl-sampling.h delete mode 100644 babl/babl-sanity.h delete mode 100644 babl/babl-type.h diff --git a/ChangeLog b/ChangeLog index 7f8f2be..70f0f34 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,65 @@ +2005-08-31 Øyvind Kolås + + * babl/babl-component.h, + * babl/babl-core.h, + * babl/babl-conversion.h, + * babl/babl-extension.h, + * babl/babl-format.h, + * babl/babl-instance.h, + * babl/babl-introspect.h, + * babl/babl-image.h, + * babl/babl-fish.h, + * babl/babl-model.h, + * babl/babl-sampling.h, + * babl/babl-sanity.h, + * babl/babl-type.h: DELETED + * babl/babl.h: defines moved from deleted headers. Added + documentation. + * babl/babl-internal.h: defines moved from deleted headers. + + * babl/Makefile.am: Reflect above changes. + * babl/babl-classes.h: redefined conversion functions to return long, + and take number of pixels as long. + * babl/babl-component.c, + * babl/babl-conversion.c, + * babl/babl-core.c, + * babl/babl-db.h, + * babl/babl-extension.c, + * babl/babl-fish.c, + * babl/babl-format.c, + * babl/babl-image.c, + * babl/babl-instance.h, + * babl/babl-internal.c, + * babl/babl-internal.h, + * babl/babl-introspect.c, + * babl/babl-memory.c, + * babl/babl-model.c, + * babl/babl-sampling.c, + * babl/babl-sanity.c, + * babl/babl-type.c, + * babl/babl.c, + * babl/base/model-cmyk.c, + * babl/base/model-gray.c, + * babl/base/model-rgb.c, + * babl/base/model-ycbcr.c, + * babl/base/type-float.c, + * babl/base/type-u16.c, + * babl/base/type-u8.c, + * docs/index-static.html.in, + * extensions/CIE-Lab.c, + * extensions/naive-CMYK.c, + * tests/babl-html-dump.c, + * tests/babl_class_name.c, + * tests/grayscale_to_rgb.c, + * tests/introspect.c, + * tests/models.c, + * tests/nop.c, + * tests/rgb_to_bgr.c, + * tests/rgb_to_ycbcr.c, + * tests/sanity.c, + * tests/srgb_to_lab_u8.c, + * tests/types.c: reflect changes in headers. + 2005-08-31 Øyvind Kolås * Makefile.am, diff --git a/babl/Makefile.am b/babl/Makefile.am index c78df67..630a672 100644 --- a/babl/Makefile.am +++ b/babl/Makefile.am @@ -22,41 +22,16 @@ c_sources = \ h_sources = \ babl-classes.h \ - babl-component.h \ - babl-core.h \ - babl-conversion.h \ babl-db.h \ - babl-extension.h \ - babl-format.h \ babl-ids.h \ - babl-instance.h \ babl-internal.h \ - babl-introspect.h \ - babl-image.h \ - babl-fish.h \ babl-memory.h \ - babl-model.h \ - babl-sampling.h \ - babl-sanity.h \ - babl-type.h \ babl-util.h \ babl.h library_includedir=$(includedir)/babl-$(BABL_API_VERSION)/babl library_include_HEADERS = \ - babl.h \ - babl-classes.h \ - babl-component.h \ - babl-conversion.h \ - babl-extension.h \ - babl-fish.h \ - babl-ids.h \ - babl-image.h \ - babl-instance.h \ - babl-model.h \ - babl-format.h \ - babl-sampling.h \ - babl-type.h + babl.h INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/babl/base diff --git a/babl/babl-classes.h b/babl/babl-classes.h index f6850b4..8285a86 100644 --- a/babl/babl-classes.h +++ b/babl/babl-classes.h @@ -21,22 +21,22 @@ #define _BABL_CLASSES_H /* Type and Format */ -typedef void (*BablFuncLinear) (void *src, +typedef long (*BablFuncLinear) (void *src, void *dst, int src_pitch, int dst_pitch, - int n); + long n); /* TypePlanar, ModelPlanar and FormatPlanar */ -typedef void (*BablFuncPlanar) (int src_bands, +typedef long (*BablFuncPlanar) (int src_bands, void *src[], int src_pitch[], int dst_bands, void *dst[], int dst_pitch[], - int n); + long n); -typedef void (*BablFuncPlanarBit) (int src_bands, +typedef long (*BablFuncPlanarBit) (int src_bands, void *src[], int src_bit[], int src_pitch[], @@ -46,7 +46,7 @@ typedef void (*BablFuncPlanarBit) (int src_bands, int dst_bit[], int dst_pitch[], int dst_bit_pitch[], - int n); + long n); /* magic number used at the start of all babl objects, used to do * differentiation in polymorphic functions. (as well as manual diff --git a/babl/babl-component.c b/babl/babl-component.c index c0f7604..46855ca 100644 --- a/babl/babl-component.c +++ b/babl/babl-component.c @@ -58,7 +58,7 @@ component_new (const char *name, } Babl * -babl_component_new (const char *name, +babl_component_new (void *first_arg, ...) { va_list varg; @@ -67,9 +67,9 @@ babl_component_new (const char *name, int luma = 0; int chroma = 0; int alpha = 0; - const char *arg=name; + const char *arg=(char*)first_arg; - va_start (varg, name); + va_start (varg, first_arg); while (1) { @@ -108,13 +108,13 @@ babl_component_new (const char *name, else { - babl_fatal ("unhandled argument '%s' for format '%s'", arg, name); + babl_fatal ("unhandled argument '%s' for format '%s'", arg, first_arg); } } va_end (varg); - babl = component_new (name, id, luma, chroma, alpha); + babl = component_new (first_arg, id, luma, chroma, alpha); { Babl *ret = db_insert (babl); @@ -124,4 +124,4 @@ babl_component_new (const char *name, } } -BABL_CLASS_TEMPLATE (babl_component) +BABL_CLASS_TEMPLATE (component) diff --git a/babl/babl-component.h b/babl/babl-component.h deleted file mode 100644 index 6ad5d8c..0000000 --- a/babl/babl-component.h +++ /dev/null @@ -1,28 +0,0 @@ -/* babl - dynamically extendable universal pixel conversion library. - * Copyright (C) 2005, Øyvind Kolås. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef _BABL_COMPONENT_H -#define _BABL_COMPONENT_H - -#include "babl-classes.h" -#include "babl-instance.h" - - -BABL_DEFINE_CLASS (babl_component) -#endif diff --git a/babl/babl-conversion.c b/babl/babl-conversion.c index d400ca3..38859d0 100644 --- a/babl/babl-conversion.c +++ b/babl/babl-conversion.c @@ -19,8 +19,6 @@ #include "babl-internal.h" #include "babl-db.h" -#include "babl-extension.h" -#include "assert.h" #include #include @@ -146,9 +144,7 @@ create_name (Babl *source, Babl *destination) } Babl * -babl_conversion_new (Babl *source, - Babl *destination, - void *first_arg, +babl_conversion_new (void *first_arg, ...) { va_list varg; @@ -164,12 +160,18 @@ babl_conversion_new (Babl *source, int got_func = 0; const char *arg = first_arg; + Babl *source; + Babl *destination; + + va_start (varg, first_arg); + source = (Babl*) arg; + destination = va_arg (varg, Babl*); + arg = va_arg (varg, char *); + assert (BABL_IS_BABL(source)); assert (BABL_IS_BABL(destination)); - va_start (varg, first_arg); - - while (1) + while (arg) { if (!strcmp (arg, "id")) @@ -218,8 +220,6 @@ babl_conversion_new (Babl *source, } arg = va_arg (varg, char *); - if (!arg) - break; } va_end (varg); @@ -238,7 +238,7 @@ babl_conversion_new (Babl *source, } } -static void +static long babl_conversion_linear_process (BablConversion *conversion, void *source, void *destination, @@ -247,9 +247,10 @@ babl_conversion_linear_process (BablConversion *conversion, long n) { conversion->function.linear (source, destination, src_pitch, dst_pitch, n); + return n; } -static void +static long babl_conversion_planar_process (BablConversion *conversion, BablImage *source, BablImage *destination, @@ -273,20 +274,16 @@ babl_conversion_planar_process (BablConversion *conversion, dst_data, destination->pitch, n); + return n; } -/* this is the place to insert usage instrumentation into babl */ -void +long babl_conversion_process (BablConversion *conversion, void *source, void *destination, long n) { - /*TODO: build planar formats if needed when linear pointers are passed in */ - assert (BABL_IS_BABL (conversion)); - - conversion->processings++; - conversion->pixels += n; + babl_assert (BABL_IS_BABL (conversion)); switch (BABL(conversion)->class_type) { @@ -331,8 +328,8 @@ babl_conversion_process (BablConversion *conversion, } break; case BABL_CONVERSION_MODEL_PLANAR: - assert (BABL_IS_BABL (source)); - assert (BABL_IS_BABL (destination)); + babl_assert (BABL_IS_BABL (source)); + babl_assert (BABL_IS_BABL (destination)); babl_conversion_planar_process ( conversion, (BablImage*) source, @@ -343,9 +340,10 @@ babl_conversion_process (BablConversion *conversion, babl_log ("args=(%s, %p, %p, %li) unhandled conversion type: %s", conversion->instance.name, source, destination, n, babl_class_name (conversion->instance.class_type)); + return 0; break; } - + return n; } -BABL_CLASS_TEMPLATE (babl_conversion) +BABL_CLASS_TEMPLATE (conversion) diff --git a/babl/babl-conversion.h b/babl/babl-conversion.h deleted file mode 100644 index e33a44b..0000000 --- a/babl/babl-conversion.h +++ /dev/null @@ -1,37 +0,0 @@ -/* babl - dynamically extendable universal pixel conversion library. - * Copyright (C) 2005, Øyvind Kolås. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef BABL_CONVERSION_H -#define BABL_CONVERSION_H - -#include "babl-classes.h" -#include "babl-instance.h" - -void babl_conversion_process (BablConversion *conversion, - void *source, - void *destination, - long n); - -Babl * babl_conversion_new (Babl *source, - Babl *destination, - void *first_argument, - ...); - -BABL_DEFINE_CLASS_NO_NEW (babl_conversion); -#endif diff --git a/babl/babl-core.c b/babl/babl-core.c index 8fd50a4..d5fff5e 100644 --- a/babl/babl-core.c +++ b/babl/babl-core.c @@ -22,36 +22,38 @@ #include "babl-ids.h" #include "util.h" -static void +static long convert_double_double (void *src, void *dst, int src_pitch, int dst_pitch, - int n) + long n) { if (src_pitch == 64 && dst_pitch == 64) { memcpy (dst, src, n/8); - return; + return n; } + while (n--) { (*(double *) dst) = (*(double *) src); dst += dst_pitch; src += src_pitch; } + return n; } -static void +static long copy_strip_1 (int src_bands, void **src, int *src_pitch, int dst_bands, void **dst, int *dst_pitch, - int n) + long n) { BABL_PLANAR_SANITY while (n--) @@ -70,6 +72,7 @@ copy_strip_1 (int src_bands, BABL_PLANAR_STEP } + return n; } void diff --git a/babl/babl-core.h b/babl/babl-core.h deleted file mode 100644 index e75909c..0000000 --- a/babl/babl-core.h +++ /dev/null @@ -1,25 +0,0 @@ -/* babl - dynamically extendable universal pixel conversion library. - * Copyright (C) 2005, Øyvind Kolås. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef BABL_CORE_H -#define BABL_CORE_H - -void babl_core_init (void); - -#endif diff --git a/babl/babl-db.h b/babl/babl-db.h index 14c0d34..883f81a 100644 --- a/babl/babl-db.h +++ b/babl/babl-db.h @@ -22,12 +22,9 @@ #define _DB_H #ifndef _BABL_INTERNAL_H -#error babl-internal.h must be included before babl-db.h, babl-db.h is strictly internal to babl core classes. +#error babl-db.h is only to be included after babl-internal.h #endif -#include "babl-instance.h" -#include "babl-extension.h" - #include #define DB_DEF static inline @@ -116,19 +113,7 @@ db_insert (Babl *babl) collision = db_exist (babl->instance.id, babl->instance.name); if (collision) - { -#if 0 - if (!strcmp (collision->instance.name, babl->instance.name) ) - babl_log ("conflicting name:\n\t\tnew: '%s'\n\t\texisting '%s' from %s", - babl->instance.name, collision->instance.name, - collision->instance.creator?BABL(collision->instance.creator)->instance.name:"core"); - else if (collision->instance.id == babl->instance.id) - babl_log ("conflicting id:\n\t\tnew: '%s' (id=%i)\n\t\texisting '%s' from %s", - babl->instance.name, babl->instance.id, collision->instance.name, - collision->instance.creator?BABL(collision->instance.creator)->instance.name:"core"); -#endif - return collision; - } + return collision; if (db_entries + 1 > db_size) /* must reallocate storage */ { @@ -169,31 +154,29 @@ db_each (BablEachFunction each_fun, } } -typedef struct DbExistData +typedef struct BablDbExistData { unsigned int type; int id; const char *name; Babl *ret; -} DbExistData; +} BablDbExistData; DB_DEF int db_each_exist (Babl *babl, void *void_data) { - DbExistData *data = void_data; + BablDbExistData *data = void_data; - if (data->id && - data->id == babl->instance.id) + if (data->id && data->id == babl->instance.id) { - data->ret = babl; - return 1; + data->ret = babl; + return 1; /* stop iterating */ } - if (data->name && - !strcmp (babl->instance.name, data->name)) + else if (data->name && !strcmp (babl->instance.name, data->name)) { data->ret = babl; - return 1; + return 1; /* stop iterating */ } return 0; /* continue iterating */ } @@ -202,7 +185,7 @@ DB_DEF Babl * db_exist (int id, const char *name) { - DbExistData data; + BablDbExistData data; data.id = id; data.name = name; diff --git a/babl/babl-extension.c b/babl/babl-extension.c index 6954eb9..26ca1f8 100644 --- a/babl/babl-extension.c +++ b/babl/babl-extension.c @@ -18,9 +18,14 @@ */ #define BABL_DYNAMIC_EXTENSIONS -#define BABL_PATH "/usr/lib/babl:/usr/local/lib/babl:~/.babl"; + +#ifdef HAVE_CONFIG_H +#include "config.h" +#else +#define BABL_PATH "~/.babl-0.0:/usr/local/lib/babl-0.0:/usr/lib/babl-0.0"; #define BABL_PATH_SEPERATOR "/" #define BABL_LIST_SEPERATOR ':' +#endif @@ -131,7 +136,6 @@ destroy_hook (void) #include #include #include -#include #include #ifndef RTLD_NOW @@ -336,4 +340,4 @@ each_babl_extension_destroy (Babl *babl, return 0; /* continue iterating */ } -BABL_CLASS_TEMPLATE (babl_extension) +BABL_CLASS_TEMPLATE (extension) diff --git a/babl/babl-extension.h b/babl/babl-extension.h deleted file mode 100644 index 3de0c58..0000000 --- a/babl/babl-extension.h +++ /dev/null @@ -1,34 +0,0 @@ -/* babl - dynamically extendable universal pixel conversion library. - * Copyright (C) 2005, Øyvind Kolås. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef _BABL_EXTENSION_H -#define _BABL_EXTENSION_H - -#include "babl-classes.h" -#include "babl-instance.h" - -Babl * babl_extension_base (void); - -Babl * babl_extender (void); -void babl_set_extender (Babl *new_extender); - -Babl * babl_extension_quiet_log (void); - -BABL_DEFINE_CLASS (babl_extension) -#endif diff --git a/babl/babl-fish.c b/babl/babl-fish.c index 442bc7f..bdc87d8 100644 --- a/babl/babl-fish.c +++ b/babl/babl-fish.c @@ -19,15 +19,14 @@ #include "babl-internal.h" #include "babl-db.h" -#include "assert.h" #include #include -#include "babl-type.h" +/*#include "babl-type.h" #include "babl-model.h" #include "babl-image.h" #include "babl-component.h" -#include "babl-format.h" +#include "babl-format.h"*/ static int each_babl_fish_destroy (Babl *babl, @@ -51,38 +50,6 @@ create_name (Babl *source, return buf; } -Babl * -babl_fish_new (Babl *source, - Babl *destination) -{ - Babl *babl = NULL; - const char *name; - - assert (BABL_IS_BABL (source)); - assert (BABL_IS_BABL (destination)); - - name = create_name (source, destination, 0); - - babl = babl_malloc (sizeof (BablFishReference) + - strlen (name) + 1); - babl->class_type = BABL_FISH; - babl->instance.id = 0; - babl->instance.name = ((void *)babl) + sizeof(BablFishReference); - strcpy (babl->instance.name, name); - babl->fish.source = (union Babl*)source; - babl->fish.destination = (union Babl*)destination; - - babl->fish.processings = 0; - babl->fish.pixels = 0; - - { - Babl *ret = db_insert (babl); - if (ret!=babl) - babl_free (babl); - return ret; - } -} - typedef struct SearchData { Babl *source; @@ -90,8 +57,8 @@ typedef struct SearchData BablConversion *result; } SearchData; -BablConversion *babl_conversion_find (void *source, - void *destination) +Babl *babl_conversion_find (void *source, + void *destination) { int i=0; Babl **conversion; @@ -100,7 +67,7 @@ BablConversion *babl_conversion_find (void *source, while (conversion[i]) { if (conversion[i]->conversion.destination == destination) - return (BablConversion*)conversion[i]; + return (Babl*)conversion[i]; i++; } babl_fatal ("failed, aborting"); @@ -115,11 +82,11 @@ babl_fish_reference_new (Babl *source, Babl *babl = NULL; char *name = create_name (source, destination, 1); - assert (BABL_IS_BABL (source)); - assert (BABL_IS_BABL (destination)); + babl_assert (BABL_IS_BABL (source)); + babl_assert (BABL_IS_BABL (destination)); - assert (source->class_type == BABL_FORMAT); - assert (destination->class_type == BABL_FORMAT); + babl_assert (source->class_type == BABL_FORMAT); + babl_assert (destination->class_type == BABL_FORMAT); babl = babl_malloc (sizeof (BablFishReference) + strlen (name) + 1); @@ -148,8 +115,8 @@ babl_fish (void *source, Babl *source_format = NULL; Babl *destination_format = NULL; - assert (source); - assert (destination); + babl_assert (source); + babl_assert (destination); if (BABL_IS_BABL (source)) { @@ -233,7 +200,7 @@ convert_to_double (BablFormat *source_fmt, } } - babl_conversion_process ( + babl_process ( babl_conversion_find (src_img->type[0], dst_img->type[0]), src_img, dst_img, n); @@ -288,7 +255,7 @@ convert_from_double (BablFormat *destination_fmt, } } - babl_conversion_process ( + babl_process ( babl_conversion_find (src_img->type[0], dst_img->type[0]), src_img, dst_img, n); @@ -337,7 +304,7 @@ process_same_model (Babl *babl, return 0; } -static int +int babl_fish_reference_process (Babl *babl, BablImage *source, BablImage *destination, @@ -382,7 +349,7 @@ babl_fish_reference_process (Babl *babl, n ); - babl_conversion_process ( + babl_process ( babl_conversion_find ( BABL(babl->fish.source)->format.model, babl_model_id (BABL_RGBA) @@ -390,7 +357,7 @@ babl_fish_reference_process (Babl *babl, source_image, rgba_image, n); - babl_conversion_process ( + babl_process ( babl_conversion_find ( babl_model_id (BABL_RGBA), BABL(babl->fish.destination)->format.model @@ -416,7 +383,7 @@ babl_fish_reference_process (Babl *babl, return 0; } -static int +int babl_fish_process (Babl *babl, void *source, void *destination, @@ -427,52 +394,7 @@ babl_fish_process (Babl *babl, } -int -babl_process (Babl *babl, - void *source, - void *destination, - long n) -{ - assert (babl); - assert (source); - assert (destination); - assert (BABL_IS_BABL (babl)); - assert (n>0); - - babl->fish.processings++; - babl->fish.pixels += n; - - if (babl->class_type == BABL_FISH) - return babl_fish_process (babl, source, destination, n); - - if (babl->class_type == BABL_FISH_REFERENCE) - { - BablImage *source_image = NULL; - BablImage *destination_image = NULL; - - if (BABL_IS_BABL (source)) - source_image = source; - if (!source_image) - source_image = (BablImage*) babl_image_from_linear ( - source, (Babl*)babl->fish.source); - if (BABL_IS_BABL (destination)) - destination_image = destination; - if (!destination_image) - destination_image = (BablImage*) babl_image_from_linear ( - destination, (Babl*)babl->fish.destination); - - babl_fish_reference_process (babl, source, destination, n); - - babl_free (source_image); - babl_free (destination_image); - - return 0; - } - - babl_log ("eek"); - return -1; -} -BABL_DEFINE_INIT (babl_fish) -BABL_DEFINE_DESTROY (babl_fish) -BABL_DEFINE_EACH (babl_fish) +BABL_DEFINE_INIT (fish) +BABL_DEFINE_DESTROY (fish) +BABL_DEFINE_EACH (fish) diff --git a/babl/babl-fish.h b/babl/babl-fish.h deleted file mode 100644 index 0b15bb2..0000000 --- a/babl/babl-fish.h +++ /dev/null @@ -1,49 +0,0 @@ -/* babl - dynamically extendable universal pixel conversion library. - * Copyright (C) 2005, Øyvind Kolås. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef BABL_FISH_H -#define BABL_FISH_H - -#include "babl-classes.h" -#include "babl-instance.h" - -/** create a new BablFish capable of translating between the pixel - * formats given in source and destination. (use babl_format (string)) - */ -Babl * babl_fish (void *source, - void *destination); - -/* Transform n pixels from source into destination, - * source and destination can be pointers to linear buffers - * (or at a later stage of babl development BablImages) - */ -int babl_process (Babl *babl_fish, - void *source, - void *destination, - int n); - -/* whether the BablFish needs a BablImage to do the processing, - * or a void pointer to a linear buffer is sufficient. - */ -int babl_fish_needs_image (Babl *babl_fish); - - - -BABL_DEFINE_CLASS_NO_NEW_NO_ID(babl_fish) -#endif diff --git a/babl/babl-format.c b/babl/babl-format.c index b00d5a2..d095701 100644 --- a/babl/babl-format.c +++ b/babl/babl-format.c @@ -21,9 +21,6 @@ #include #include "babl-internal.h" -#include "babl-sampling.h" -#include "babl-type.h" -#include "babl-component.h" #include "babl-db.h" static int @@ -259,4 +256,4 @@ babl_format_new (void *first_arg, } } -BABL_CLASS_TEMPLATE (babl_format) +BABL_CLASS_TEMPLATE (format) diff --git a/babl/babl-format.h b/babl/babl-format.h deleted file mode 100644 index ed3329c..0000000 --- a/babl/babl-format.h +++ /dev/null @@ -1,28 +0,0 @@ -/* babl - dynamically extendable universal pixel conversion library. - * Copyright (C) 2005, Øyvind Kolås. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef _BABL_FORMAT_H -#define _BABL_FORMAT_H - -#include "babl-classes.h" -#include "babl-instance.h" - -BABL_DEFINE_CLASS (babl_format) - -#endif diff --git a/babl/babl-image.c b/babl/babl-image.c index 042b66e..8535554 100644 --- a/babl/babl-image.c +++ b/babl/babl-image.c @@ -19,14 +19,8 @@ #include #include -#include #include "babl-internal.h" -#include "babl-image.h" -#include "babl-type.h" -#include "babl-sampling.h" -#include "babl-component.h" - static Babl * image_new (BablFormat *format, @@ -90,9 +84,9 @@ babl_image_from_linear (void *buffer, int offset=0; int calc_pitch=0; - assert (format); - assert (format->class_type == BABL_FORMAT || - format->class_type == BABL_MODEL); + babl_assert (format); + babl_assert (format->class_type == BABL_FORMAT || + format->class_type == BABL_MODEL); switch (format->class_type) { diff --git a/babl/babl-image.h b/babl/babl-image.h deleted file mode 100644 index 799be04..0000000 --- a/babl/babl-image.h +++ /dev/null @@ -1,45 +0,0 @@ -/* babl - dynamically extendable universal pixel conversion library. - * Copyright (C) 2005, Øyvind Kolås. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef _BABL_IMAGE_H -#define _BABL_IMAGE_H - -#include "babl-classes.h" - -/* babl images are allocated as a single chunk of memory, and - * thus can be duplicated using duplicate = babl_dup (original); - * - * NB: babl_fish_process () frees the images passed in by itself. - */ -Babl * babl_image (void *first_component, - ...); - -/* create a new BablImage based on a packed BablFormat (or BablModel which - * is a virtual pixelformat based on the BablModel using only doubles in the - * order they are listed in the model. - */ -Babl * babl_image_from_linear (void *buffer, - Babl *format); - -/* create a new babl image similar to the provided babl-image, but where all data - * is in doubles,.. - */ -Babl * babl_image_double_from_image (Babl *source); - -#endif diff --git a/babl/babl-instance.h b/babl/babl-instance.h deleted file mode 100644 index c5bf2ad..0000000 --- a/babl/babl-instance.h +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef _BABL_INSTANCE_H -#define _BABL_INSTANCE_H - -#include "babl-classes.h" -typedef int (*BablEachFunction) (Babl *entry, - void *data); - - -/* these defines are kept here to keep the typing needed in class - * headers to a minimum, only the ones overriding the basic api with - * custom ways of construction. - */ -#define BABL_DEFINE_CLASS(type_name) \ - \ -void type_name##_init (void); \ -void type_name##_destroy (void); \ -void type_name##_each (BablEachFunction each_fun, \ - void *user_data); \ -Babl * type_name (const char *name); \ -Babl * type_name##_id (int id); \ -Babl * type_name##_new (void *first_arg, \ - ...); - - -#define BABL_DEFINE_CLASS_NO_NEW(type_name) \ - \ -void type_name##_init (void); \ -void type_name##_destroy (void); \ -void type_name##_each (BablEachFunction each_fun, \ - void *user_data); \ -Babl * type_name##_id (int id); - -#define BABL_DEFINE_CLASS_NO_NEW_NO_ID(type_name) \ - \ -void type_name##_init (void); \ -void type_name##_destroy (void); \ -void type_name##_each (BablEachFunction each_fun, \ - void *user_data); - -#endif diff --git a/babl/babl-internal.c b/babl/babl-internal.c index f19e5b7..9ca17e8 100644 --- a/babl/babl-internal.c +++ b/babl/babl-internal.c @@ -68,6 +68,62 @@ babl_die (void) exit (-1); } +long babl_conversion_process (Babl *conversion, + void *source, + void *destination, + long n); +long +babl_process (Babl *babl, + void *source, + void *destination, + long n) +{ + babl_assert (babl); + babl_assert (source); + babl_assert (destination); + babl_assert (BABL_IS_BABL (babl)); + babl_assert (n>0); + + /* these fields are common between conversions and fishes */ + babl->fish.processings++; + babl->fish.pixels += n; + + /* matches all conversion classes */ + if (babl->class_type >= BABL_CONVERSION && + babl->class_type <= BABL_CONVERSION_FORMAT_PLANAR) + return babl_conversion_process (babl, source, destination, n); + + if (babl->class_type == BABL_FISH) + return babl_fish_process (babl, source, destination, n); + + if (babl->class_type == BABL_FISH_REFERENCE) + { + BablImage *source_image = NULL; + BablImage *destination_image = NULL; + + if (BABL_IS_BABL (source)) + source_image = source; + if (!source_image) + source_image = (BablImage*) babl_image_from_linear ( + source, (Babl*)babl->fish.source); + if (BABL_IS_BABL (destination)) + destination_image = destination; + if (!destination_image) + destination_image = (BablImage*) babl_image_from_linear ( + destination, (Babl*)babl->fish.destination); + + babl_fish_reference_process (babl, source, destination, n); + + babl_free (source_image); + babl_free (destination_image); + + return 0; + } + + babl_log ("eek"); + return -1; +} + void babl_internal_init (void) { @@ -80,3 +136,10 @@ babl_internal_destroy (void) { } + +const char * +babl_name (Babl *babl) +{ + babl_assert (BABL_IS_BABL (babl)); + return babl->instance.name; +} diff --git a/babl/babl-internal.h b/babl/babl-internal.h index e8d3152..21599a3 100644 --- a/babl/babl-internal.h +++ b/babl/babl-internal.h @@ -20,26 +20,49 @@ #ifndef _BABL_INTERNAL_H #define _BABL_INTERNAL_H +#ifdef _BABL_H +#error babl-internal.h included after babl.h +#endif + #define BABL_MAX_COMPONENTS 32 #include #include #include +#include "assert.h" #include "babl-classes.h" -#include "babl-instance.h" +#undef _BABL_INTERNAL_H +#include "babl.h" +#define _BABL_INTERNAL_H + #include "babl-ids.h" #include "babl-util.h" #include "babl-memory.h" -/* internal classes */ -#include "babl-introspect.h" -#include "babl-conversion.h" -#include "babl-extension.h" -/* */ -void babl_die (void); +int babl_fish_process (Babl *babl, + void *source, + void *destination, + long n); +int babl_fish_reference_process (Babl *babl, + BablImage *source, + BablImage *destination, + long n); +Babl * babl_image_from_linear (void *buffer, + Babl *format); +Babl * babl_image_double_from_image (Babl *source); +void babl_die (void); +int babl_sanity (void); +Babl * babl_extension_base (void); + +Babl * babl_extender (void); +void babl_set_extender (Babl *new_extender); + +Babl * babl_extension_quiet_log (void); + +void babl_core_init (void); /**** LOGGER ****/ #include @@ -69,25 +92,33 @@ real_babl_log (const char *file, fprintf (stdout, "\n"); } -#define babl_log(args...) real_babl_log(__FILE__, __LINE__, __FUNCTION__, args) +#define babl_log(args...) \ + real_babl_log(__FILE__, __LINE__, __FUNCTION__, args) -#define babl_fatal(args...) \ - do{ \ - real_babl_log(__FILE__, __LINE__, __FUNCTION__, args);\ - babl_die();} \ - while(0); +#define babl_fatal(args...) do{ \ + real_babl_log(__FILE__, __LINE__, __FUNCTION__, args);\ + babl_die();} \ +while(0) -/********************/ +#define babl_assert(expr) do{ \ + if(!(expr)) \ + { \ + babl_fatal("Eeeeek"); \ + assert(expr); \ + } \ +}while(0) +/***** LOGGER (end)**/ -#define BABL_CLASS_TYPE_IS_VALID(klass_type) \ +#define BABL_CLASS_TYPE_IS_VALID(klass_type) \ ( ((klass_type)>=BABL_INSTANCE ) && ((klass_type)<=BABL_SKY) ?1:0 ) -#define BABL_IS_BABL(obj) \ -(NULL==(obj)?0: \ - BABL_CLASS_TYPE_IS_VALID(((Babl*)(obj))->class_type) \ +#define BABL_IS_BABL(obj) \ +(NULL==(obj)?0 \ + :BABL_CLASS_TYPE_IS_VALID(((Babl*)(obj))->class_type) \ ) + extern int babl_hmpf_on_name_lookups; const char *babl_class_name (BablClassType klass); @@ -97,7 +128,7 @@ void babl_internal_destroy (void); #define BABL_DEFINE_EACH(type_name) \ void \ -type_name##_each (BablEachFunction each_fun, \ +babl_##type_name##_each (BablEachFunction each_fun, \ void *user_data) \ { \ db_each (each_fun, user_data); \ @@ -105,7 +136,7 @@ type_name##_each (BablEachFunction each_fun, \ #define BABL_DEFINE_LOOKUP_BY_ID(type_name) \ Babl * \ -type_name##_id (int id) \ +babl_##type_name##_id (int id) \ { \ Babl *babl; \ babl = db_exist (id, NULL); \ @@ -118,7 +149,7 @@ type_name##_id (int id) \ #define BABL_DEFINE_LOOKUP_BY_NAME(type_name) \ Babl * \ -type_name (const char *name) \ +babl_##type_name (const char *name) \ { \ Babl *babl; \ \ @@ -150,7 +181,7 @@ type_name (const char *name) \ #define BABL_DEFINE_INIT(type_name) \ void \ -type_name##_init (void) \ +babl_##type_name##_init (void) \ { \ BABL_PRE_INIT_HOOK; \ db_init (); \ @@ -159,10 +190,10 @@ type_name##_init (void) \ #define BABL_DEFINE_DESTROY(type_name) \ void \ -type_name##_destroy (void) \ +babl_##type_name##_destroy (void) \ { \ BABL_DESTROY_PRE_HOOK; \ - db_each (each_##type_name##_destroy, NULL); \ + db_each (each_babl_##type_name##_destroy, NULL); \ db_destroy (); \ BABL_DESTROY_HOOK; \ } diff --git a/babl/babl-introspect.c b/babl/babl-introspect.c index fb2d0f6..12b4ffd 100644 --- a/babl/babl-introspect.c +++ b/babl/babl-introspect.c @@ -17,7 +17,6 @@ * Boston, MA 02111-1307, USA. */ -#include "babl.h" #include "babl-internal.h" /* for babl_log */ #define BABL_LOG diff --git a/babl/babl-introspect.h b/babl/babl-introspect.h deleted file mode 100644 index e9f580c..0000000 --- a/babl/babl-introspect.h +++ /dev/null @@ -1,28 +0,0 @@ -/* babl - dynamically extendable universal pixel conversion library. - * Copyright (C) 2005, Øyvind Kolås. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef _BABL_INTROSPECT_H -#define _BABL_INTROSPECT_H - -#include "babl-classes.h" - -void -babl_introspect (Babl *babl); - -#endif diff --git a/babl/babl-memory.c b/babl/babl-memory.c index 811414e..13e518c 100644 --- a/babl/babl-memory.c +++ b/babl/babl-memory.c @@ -17,7 +17,6 @@ * Boston, MA 02111-1307, USA. */ -#include #include #include #include @@ -98,12 +97,12 @@ babl_malloc (size_t size) { void *ret; - assert (size); + babl_assert (size); functions_sanity (); ret = malloc_f (size + OFFSET); if (!ret) - babl_log ("args=(%i): failed", size); + babl_fatal ("args=(%i): failed", size); BAI(ret + OFFSET)->signature = signature; BAI(ret + OFFSET)->size = size; @@ -120,7 +119,7 @@ babl_dup (void *ptr) { void *ret; - assert (IS_BAI (ptr)); + babl_assert (IS_BAI (ptr)); ret = babl_malloc (BAI(ptr)->size); memcpy (ret, ptr, BAI(ptr)->size); @@ -159,7 +158,7 @@ babl_realloc (void *ptr, return babl_malloc (size); } - assert (IS_BAI (ptr)); + babl_assert (IS_BAI (ptr)); if (size==0) { @@ -207,7 +206,7 @@ babl_calloc (size_t nmemb, size_t babl_sizeof (void *ptr) { - assert (IS_BAI (ptr)); + babl_assert (IS_BAI (ptr)); return BAI(ptr)->size; } @@ -250,7 +249,7 @@ babl_strcat (char *dest, strcpy (ret, src); return ret; } - assert (IS_BAI (dest)); + babl_assert (IS_BAI (dest)); dst_len = strlen (dest); ret = dest; diff --git a/babl/babl-model.c b/babl/babl-model.c index d42a8b1..a876cc2 100644 --- a/babl/babl-model.c +++ b/babl/babl-model.c @@ -168,4 +168,4 @@ babl_model_new (void *first_argument, } } -BABL_CLASS_TEMPLATE (babl_model) +BABL_CLASS_TEMPLATE (model) diff --git a/babl/babl-model.h b/babl/babl-model.h deleted file mode 100644 index 3a19b02..0000000 --- a/babl/babl-model.h +++ /dev/null @@ -1,28 +0,0 @@ -/* babl - dynamically extendable universal pixel conversion library. - * Copyright (C) 2005, Øyvind Kolås. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef _BABL_format_H -#define _BABL_format_H - -#include "babl-classes.h" -#include "babl-instance.h" - -BABL_DEFINE_CLASS (babl_model) - -#endif diff --git a/babl/babl-sampling.c b/babl/babl-sampling.c index 7a51d51..8d786db 100644 --- a/babl/babl-sampling.c +++ b/babl/babl-sampling.c @@ -27,7 +27,7 @@ static BablSampling db[(HORIZONTAL_MAX-HORIZONTAL_MIN+1)* (VERTICAL_MAX-VERTICAL_MIN+1)]; -BablSampling * +Babl * babl_sampling (int horizontal, int vertical) { @@ -35,7 +35,7 @@ babl_sampling (int horizontal, vertical<=4 && horizontal>=1 && horizontal<=4) - return &db [ (vertical-1) * 4 + (horizontal-1)]; + return (Babl*)&db [ (vertical-1) * 4 + (horizontal-1)]; else babl_log ("babl_samping(%i,%i): arguments out of bounds", horizontal, vertical); diff --git a/babl/babl-sampling.h b/babl/babl-sampling.h deleted file mode 100644 index cdedccc..0000000 --- a/babl/babl-sampling.h +++ /dev/null @@ -1,30 +0,0 @@ -/* babl - dynamically extendable universal pixel conversion library. - * Copyright (C) 2005, Øyvind Kolås. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef _BABL_SAMPLING_H -#define _BABL_SAMPLING_H - -#include "babl-classes.h" -#include "babl-instance.h" - -Babl * babl_sampling (int horizontal, - int vertical); - -BABL_DEFINE_CLASS_NO_NEW_NO_ID(babl_sampling) -#endif diff --git a/babl/babl-sanity.c b/babl/babl-sanity.c index d68b848..bb84b0c 100644 --- a/babl/babl-sanity.c +++ b/babl/babl-sanity.c @@ -17,7 +17,6 @@ * Boston, MA 02111-1307, USA. */ -#include "babl.h" #include "babl-internal.h" static int OK; diff --git a/babl/babl-sanity.h b/babl/babl-sanity.h deleted file mode 100644 index 18c978c..0000000 --- a/babl/babl-sanity.h +++ /dev/null @@ -1,25 +0,0 @@ -/* babl - dynamically extendable universal pixel conversion library. - * Copyright (C) 2005, Øyvind Kolås. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef _BABL_SANITY_H -#define _BABL_SANITY_H - -int babl_sanity (void); - -#endif diff --git a/babl/babl-type.c b/babl/babl-type.c index 6ea73a4..49534cc 100644 --- a/babl/babl-type.c +++ b/babl/babl-type.c @@ -19,7 +19,6 @@ #include #include -#include #include "babl-internal.h" #include "babl-db.h" @@ -43,8 +42,8 @@ type_new (const char *name, { Babl *babl; - assert (bits != 0); - assert (bits % 8 == 0); + babl_assert (bits != 0); + babl_assert (bits % 8 == 0); babl = babl_malloc (sizeof (BablType) + strlen (name) + 1); babl->instance.name = (void*) babl + sizeof (BablType); @@ -59,7 +58,7 @@ type_new (const char *name, } Babl * -babl_type_new (const char *name, +babl_type_new (void *first_arg, ...) { va_list varg; @@ -72,9 +71,9 @@ babl_type_new (const char *name, double min_val = 0.0; double max_val = 0.0; - const char *arg=name; + const char *arg=first_arg; - va_start (varg, name); + va_start (varg, first_arg); while (1) { @@ -125,13 +124,13 @@ babl_type_new (const char *name, else { - babl_fatal ("unhandled argument '%s' for format '%s'", arg, name); + babl_fatal ("unhandled argument '%s' for format '%s'", arg, first_arg); } } va_end (varg); - babl = type_new (name, id, bits); + babl = type_new (first_arg, id, bits); { Babl *ret = db_insert (babl); @@ -141,4 +140,4 @@ babl_type_new (const char *name, } } -BABL_CLASS_TEMPLATE (babl_type) +BABL_CLASS_TEMPLATE (type) diff --git a/babl/babl-type.h b/babl/babl-type.h deleted file mode 100644 index f4417e3..0000000 --- a/babl/babl-type.h +++ /dev/null @@ -1,26 +0,0 @@ -/* babl - dynamically extendable universal pixel conversion library. - * Copyright (C) 2005, Øyvind Kolås. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef _BABL_TYPE_H -#define _BABL_TYPE_H - -#include "babl-classes.h" -BABL_DEFINE_CLASS (babl_type) - -#endif diff --git a/babl/babl.c b/babl/babl.c index 3d0dd1d..1388442 100644 --- a/babl/babl.c +++ b/babl/babl.c @@ -17,11 +17,7 @@ * Boston, MA 02111-1307, USA. */ -#include "babl.h" #include "babl-internal.h" -#include "babl-sanity.h" -#include "babl-introspect.h" -#include "babl-core.h" static int ref_count=0; diff --git a/babl/babl.h b/babl/babl.h index 88249d6..b178456 100644 --- a/babl/babl.h +++ b/babl/babl.h @@ -17,27 +17,176 @@ * Boston, MA 02111-1307, USA. */ +/* NOTE! the babl API is polymorphic, it is probably easier to learn + * it's usage by studying examples than this header file. The public + * functions are attempted explained anyways. + */ + #ifndef _BABL_H #define _BABL_H -#if __GNUC__ >=4 - #define BABL_NULL_TERMINATED __attribute_((__sentinel__)) -#else - #define BABL_NULL_TERMINATED +#ifdef _BABL_INTERNAL_H +#error babl.h included after babl-internal.h +#endif +#ifndef _BABL_CLASSES_H +#define Babl void #endif +/** Initialize the babl library */ +void babl_init (void); + +/** Deinitialize the babl library (frees any resources used, if the number + * of calls to babl_destroy() is is equal to the number of calls to + * babl_init() + */ +void babl_destroy (void); + + +#define BABL_CLASS_NO_NAME(type_name) \ + \ +void babl_##type_name##_init (void); \ +void babl_##type_name##_destroy (void); \ +Babl * babl_##type_name##_id (int id); \ +void babl_##type_name##_each (BablEachFunction each_fun, \ + void *user_data); + +#define BABL_CLASS(type_name) \ + \ +BABL_CLASS_NO_NAME (type_name) \ +Babl * babl_##type_name (const char *name); \ +Babl * babl_##type_name##_new (void *first_arg, \ + ...); + +typedef int (*BablEachFunction) (Babl *entry, + void *data); + + +/****************************************************************/ +/* BablFish */ BABL_CLASS_NO_NAME (fish) +/* Create a babl fish capable of converting from source_format to + * destination_format, source and destination can be + * either strings with the names of the formats or BablFormat objects. + */ +Babl * babl_fish (void *source_format, + void *destination_format); + +/** Process n pixels from source to destination using babl_fish, + * returns number of pixels converted. + */ +long babl_process (Babl *babl_fish, + void *source, + void *destination, + long n); + +/****************************************************************/ +/* BablImage */ BABL_CLASS_NO_NAME (image) +/* + * Babl images can be used for planar buffers instead of linear buffers for + * babl_process(), BablImages are still experimental, for now BablImages can be + * passed to babl_process, two different babl_process() functions will be + * needed for this since the polymorphism cannot be trusted to work on linear + * buffers. + * + * Babl * babl_image (BablComponent *component1, + * void *data, + * int pitch, + * int stride, + * [BablComponent *component1, + * void *data, + * int pitch, + * int stride, + * ...] + * NULL); + */ +Babl * babl_image (void *first_component, + ...); + + + +/****************************************************************/ +/* BablType */ BABL_CLASS (type) +/* + * A data type that babl can have in it's buffers, requires + * conversions to and from "double" to be registered before + * passing sanity. + * + * Babl * babl_type_new ( const char *name, + * "bits", int bits, + * ["min_val", double min_val,] + * ["max_val", double max_val,] + * NULL); + */ + + +/****************************************************************/ +/* BablComponent */ BABL_CLASS (component) +/* + * Babl * babl_component_new (const char *name, + * NULL); + */ + + +/****************************************************************/ +/* BablModel */ BABL_CLASS (model) +/* + * Babl * babl_model_new (["name", const char *name,] + * BablComponent *component1, + * [BablComponent *componentN, ...] + * NULL); + * + * If no name is provided a name is generated by concatenating the + * name of all the involved components. + * + */ + +/****************************************************************/ +/* BablSampling */ BABL_CLASS_NO_NAME (sampling) +/**/ +Babl * babl_sampling (int horizontal, + int vertical); + +/****************************************************************/ +/* BablFormat */ BABL_CLASS (format) +/* + * Babl * babl_format_new (["name", const char *name,] + * BablModel *model, + * [BablType *type,] + * [BablSampling, *sampling,] + * BablComponent *component1, + * [[BablType *type,] + * [BablSampling *sampling,] + * BablComponent *componentN, + * ...] + * ["planar",] + * NULL); + * + * Provided BablType and|or BablSampling is valid for the following + * components as well. If no name is provided a (long) descriptive + * name is used. + */ + + +/****************************************************************/ +/* BablExtension */ BABL_CLASS (extension) +/* + * BablExtension objects are only used internally in babl. + */ + +/****************************************************************/ +/* BablConversion */ BABL_CLASS (conversion) +/* + * Babl * babl_conversion_new (, + * <"linear"|"planar">, BablConversionFunc conv_func, + * NULL); + */ + + +const char *babl_name (Babl *babl); /* returns the name of a babl object */ +void babl_introspect (Babl *babl); /* introspect a given BablObject */ + +#undef BABL_CLASS #include -#include "babl-classes.h" -#include "babl-component.h" -#include "babl-conversion.h" -#include "babl-fish.h" -#include "babl-image.h" -#include "babl-model.h" -#include "babl-format.h" -#include "babl-type.h" -#include "babl-sampling.h" - -void babl_init (void); -void babl_destroy (void); #endif diff --git a/babl/base/model-cmyk.c b/babl/base/model-cmyk.c index 219d6ca..85df068 100644 --- a/babl/base/model-cmyk.c +++ b/babl/base/model-cmyk.c @@ -95,14 +95,14 @@ models (void) ); } -static void +static long rgb_to_cmyk (int src_bands, void **src, int *src_pitch, int dst_bands, void **dst, int *dst_pitch, - int n) + long n) { BABL_PLANAR_SANITY @@ -150,16 +150,17 @@ rgb_to_cmyk (int src_bands, BABL_PLANAR_STEP } + return n; } -static void +static long cmyk_to_rgb (int src_bands, void **src, int *src_pitch, int dst_bands, void **dst, int *dst_pitch, - int n) + long n) { BABL_PLANAR_SANITY @@ -196,17 +197,18 @@ cmyk_to_rgb (int src_bands, BABL_PLANAR_STEP } + return n; } #if 0 -static void +static long rgb_to_and_from_cmy (int src_bands, void **src, int *src_pitch, int dst_bands, void **dst, int *dst_pitch, - int n) + long n) { BABL_PLANAR_SANITY diff --git a/babl/base/model-gray.c b/babl/base/model-gray.c index b494dea..979f3b7 100644 --- a/babl/base/model-gray.c +++ b/babl/base/model-gray.c @@ -91,14 +91,14 @@ models (void) } -static void +static long rgb_to_gray (int src_bands, void **src, int *src_pitch, int dst_bands, void **dst, int *dst_pitch, - int n) + long n) { BABL_PLANAR_SANITY while (n--) @@ -124,17 +124,18 @@ rgb_to_gray (int src_bands, BABL_PLANAR_STEP } + return n; } -static void +static long rgb_to_gray_2_2 (int src_bands, void **src, int *src_pitch, int dst_bands, void **dst, int *dst_pitch, - int n) + long n) { BABL_PLANAR_SANITY while (n--) @@ -160,17 +161,18 @@ rgb_to_gray_2_2 (int src_bands, BABL_PLANAR_STEP } + return n; } -static void +static long gray_2_2_to_rgb (int src_bands, void **src, int *src_pitch, int dst_bands, void **dst, int *dst_pitch, - int n) + long n) { BABL_PLANAR_SANITY while (n--) @@ -197,18 +199,19 @@ gray_2_2_to_rgb (int src_bands, BABL_PLANAR_STEP } + return n; } -static void +static long gray_to_rgb (int src_bands, void **src, int *src_pitch, int dst_bands, void **dst, int *dst_pitch, - int n) + long n) { BABL_PLANAR_SANITY while (n--) @@ -235,16 +238,17 @@ gray_to_rgb (int src_bands, BABL_PLANAR_STEP } + return n; } -static void +static long gray_alpha_premultiplied_to_rgba (int src_bands, void **src, int *src_pitch, int dst_bands, void **dst, int *dst_pitch, - int n) + long n) { BABL_PLANAR_SANITY assert (src_bands == 2); @@ -270,17 +274,18 @@ gray_alpha_premultiplied_to_rgba (int src_bands, *(double*)dst[3] = alpha; BABL_PLANAR_STEP } + return n; } -static void +static long rgba_to_gray_alpha_premultiplied (int src_bands, void **src, int *src_pitch, int dst_bands, void **dst, int *dst_pitch, - int n) + long n) { BABL_PLANAR_SANITY; assert (src_bands == 4); @@ -304,16 +309,17 @@ rgba_to_gray_alpha_premultiplied (int src_bands, *(double*)dst[1] = alpha; BABL_PLANAR_STEP } + return n; } -static void +static long non_premultiplied_to_premultiplied (int src_bands, void **src, int *src_pitch, int dst_bands, void **dst, int *dst_pitch, - int n) + long n) { BABL_PLANAR_SANITY @@ -331,16 +337,17 @@ non_premultiplied_to_premultiplied (int src_bands, BABL_PLANAR_STEP } + return n; } -static void +static long premultiplied_to_non_premultiplied (int src_bands, void **src, int *src_pitch, int dst_bands, void **dst, int *dst_pitch, - int n) + long n) { BABL_PLANAR_SANITY @@ -365,6 +372,7 @@ premultiplied_to_non_premultiplied (int src_bands, BABL_PLANAR_STEP } + return n; } static void diff --git a/babl/base/model-rgb.c b/babl/base/model-rgb.c index aff0c28..0bf9c06 100644 --- a/babl/base/model-rgb.c +++ b/babl/base/model-rgb.c @@ -121,14 +121,14 @@ models (void) NULL); } -static void +static long copy_strip_1 (int src_bands, void **src, int *src_pitch, int dst_bands, void **dst, int *dst_pitch, - int n) + long n) { BABL_PLANAR_SANITY while (n--) @@ -147,16 +147,17 @@ copy_strip_1 (int src_bands, BABL_PLANAR_STEP } + return n; } -static void +static long g3_gamma_2_2 (int src_bands, void **src, int *src_pitch, int dst_bands, void **dst, int *dst_pitch, - int n) + long n) { BABL_PLANAR_SANITY @@ -170,17 +171,18 @@ g3_gamma_2_2 (int src_bands, BABL_PLANAR_STEP } + return n; } -static void +static long g3_inv_gamma_2_2 (int src_bands, void **src, int *src_pitch, int dst_bands, void **dst, int *dst_pitch, - int n) + long n) { BABL_PLANAR_SANITY @@ -200,16 +202,17 @@ g3_inv_gamma_2_2 (int src_bands, } BABL_PLANAR_STEP } + return n; } -static void +static long non_premultiplied_to_premultiplied (int src_bands, void **src, int *src_pitch, int dst_bands, void **dst, int *dst_pitch, - int n) + long n) { BABL_PLANAR_SANITY @@ -227,16 +230,17 @@ non_premultiplied_to_premultiplied (int src_bands, BABL_PLANAR_STEP } + return n; } -static void +static long premultiplied_to_non_premultiplied (int src_bands, void **src, int *src_pitch, int dst_bands, void **dst, int *dst_pitch, - int n) + long n) { BABL_PLANAR_SANITY @@ -261,6 +265,7 @@ premultiplied_to_non_premultiplied (int src_bands, BABL_PLANAR_STEP } + return n; } static void diff --git a/babl/base/model-ycbcr.c b/babl/base/model-ycbcr.c index 2d81078..f03cf76 100644 --- a/babl/base/model-ycbcr.c +++ b/babl/base/model-ycbcr.c @@ -74,14 +74,14 @@ models (void) NULL); } -static void +static long rgb_to_ycbcr (int src_bands, void **src, int *src_pitch, int dst_bands, void **dst, int *dst_pitch, - int n) + long n) { BABL_PLANAR_SANITY @@ -110,16 +110,17 @@ rgb_to_ycbcr (int src_bands, BABL_PLANAR_STEP } + return n; } -static void +static long ycbcr_to_rgb (int src_bands, void **src, int *src_pitch, int dst_bands, void **dst, int *dst_pitch, - int n) + long n) { BABL_PLANAR_SANITY @@ -148,6 +149,7 @@ ycbcr_to_rgb (int src_bands, BABL_PLANAR_STEP } + return n; } static void diff --git a/babl/base/type-float.c b/babl/base/type-float.c index 10576f8..0f23f22 100644 --- a/babl/base/type-float.c +++ b/babl/base/type-float.c @@ -23,12 +23,12 @@ #include "babl.h" #include "babl-ids.h" -static void +static long convert_double_float (void *src, void *dst, int src_pitch, int dst_pitch, - int n) + long n) { while (n--) { @@ -36,14 +36,15 @@ convert_double_float (void *src, dst += dst_pitch; src += src_pitch; } + return n; } -static void +static long convert_float_double (void *src, void *dst, int src_pitch, int dst_pitch, - int n) + long n) { while (n--) { @@ -51,6 +52,7 @@ convert_float_double (void *src, dst += dst_pitch; src += src_pitch; } + return n; } void diff --git a/babl/base/type-u16.c b/babl/base/type-u16.c index e26f475..170b357 100644 --- a/babl/base/type-u16.c +++ b/babl/base/type-u16.c @@ -24,7 +24,7 @@ #include "babl-ids.h" -static inline void +static inline long convert_double_u16_scaled (double min_val, double max_val, unsigned short min, @@ -33,7 +33,7 @@ convert_double_u16_scaled (double min_val, void *dst, int src_pitch, int dst_pitch, - int n) + long n) { while (n--) { @@ -51,9 +51,10 @@ convert_double_u16_scaled (double min_val, dst += dst_pitch; src += src_pitch; } + return n; } -static inline void +static inline long convert_u16_double_scaled (double min_val, double max_val, unsigned short min, @@ -62,7 +63,7 @@ convert_u16_double_scaled (double min_val, void *dst, int src_pitch, int dst_pitch, - int n) + long n) { while (n--) { @@ -80,27 +81,28 @@ convert_u16_double_scaled (double min_val, dst += dst_pitch; src += src_pitch; } + return n; } #define MAKE_CONVERSIONS(name, min_val, max_val, min, max) \ -static void \ +static long \ convert_##name##_double (void *src, \ void *dst, \ int src_pitch, \ int dst_pitch, \ - int n) \ + long n) \ { \ - convert_u16_double_scaled (min_val, max_val, min, max, \ + return convert_u16_double_scaled (min_val, max_val, min, max, \ src, dst, src_pitch, dst_pitch, n);\ } \ -static void \ +static long \ convert_double_##name (void *src, \ void *dst, \ int src_pitch, \ int dst_pitch, \ - int n) \ + long n) \ { \ - convert_double_u16_scaled (min_val, max_val, min, max, \ + return convert_double_u16_scaled (min_val, max_val, min, max, \ src, dst, src_pitch, dst_pitch, n);\ } diff --git a/babl/base/type-u8.c b/babl/base/type-u8.c index 99a4af6..f802fa9 100644 --- a/babl/base/type-u8.c +++ b/babl/base/type-u8.c @@ -23,7 +23,7 @@ #include "babl.h" #include "babl-ids.h" -static inline void +static inline long convert_double_u8_scaled (double min_val, double max_val, unsigned char min, @@ -32,7 +32,7 @@ convert_double_u8_scaled (double min_val, void *dst, int src_pitch, int dst_pitch, - int n) + long n) { while (n--) { @@ -50,9 +50,10 @@ convert_double_u8_scaled (double min_val, src += src_pitch; dst += dst_pitch; } + return n; } -static inline void +static inline long convert_u8_double_scaled (double min_val, double max_val, unsigned char min, @@ -61,7 +62,7 @@ convert_u8_double_scaled (double min_val, void *dst, int src_pitch, int dst_pitch, - int n) + long n) { while (n--) { @@ -80,27 +81,28 @@ convert_u8_double_scaled (double min_val, dst += dst_pitch; src += src_pitch; } + return n; } #define MAKE_CONVERSIONS(name, min_val, max_val, min, max) \ -static void \ +static long \ convert_##name##_double (void *src, \ void *dst, \ int src_pitch, \ int dst_pitch, \ - int n) \ + long n) \ { \ - convert_u8_double_scaled (min_val, max_val, min, max, \ + return convert_u8_double_scaled (min_val, max_val, min, max, \ src, dst, src_pitch, dst_pitch, n); \ } \ -static void \ +static long \ convert_double_##name (void *src, \ void *dst, \ int src_pitch, \ int dst_pitch, \ - int n) \ + long n) \ { \ - convert_double_u8_scaled (min_val, max_val, min, max, \ + return convert_double_u8_scaled (min_val, max_val, min, max, \ src, dst, src_pitch, dst_pitch, n); \ } diff --git a/docs/index-static.html.in b/docs/index-static.html.in index 1f65435..a1a0e6f 100644 --- a/docs/index-static.html.in +++ b/docs/index-static.html.in @@ -62,6 +62,7 @@

News

+

Also see the CVS ChangeLog.

Features

@@ -73,7 +74,7 @@
  • Planar and linear buffers
  • Thread safety for processing.
  • -
  • Extension and introspection of formats, +
  • Extension and introspection of formats, color models, components and datatypes
  • Horizontal an vertical subsampling (for implementing 4:2:2 4:2:0 4:1:1 etc. chroma subsampling)
  • diff --git a/extensions/CIE-Lab.c b/extensions/CIE-Lab.c index 0f321bd..dd90b76 100644 --- a/extensions/CIE-Lab.c +++ b/extensions/CIE-Lab.c @@ -142,14 +142,14 @@ cpercep_distance_space (const double L1, const double a1, const double b1, -static void +static long rgb_to_lab (int src_bands, void **src, int *src_pitch, int dst_bands, void **dst, int *dst_pitch, - int n) + long n) { BABL_PLANAR_SANITY @@ -172,16 +172,17 @@ rgb_to_lab (int src_bands, BABL_PLANAR_STEP } + return n; } -static void +static long lab_to_rgb (int src_bands, void **src, int *src_pitch, int dst_bands, void **dst, int *dst_pitch, - int n) + long n) { BABL_PLANAR_SANITY @@ -204,6 +205,7 @@ lab_to_rgb (int src_bands, BABL_PLANAR_STEP } + return n; } static void @@ -289,7 +291,7 @@ formats (void) } -static inline void +static inline long convert_double_u8_scaled (double min_val, double max_val, unsigned char min, @@ -298,7 +300,7 @@ convert_double_u8_scaled (double min_val, void *dst, int src_pitch, int dst_pitch, - int n) + long n) { while (n--) { @@ -316,9 +318,10 @@ convert_double_u8_scaled (double min_val, src += src_pitch; dst += dst_pitch; } + return n; } -static inline void +static inline long convert_u8_double_scaled (double min_val, double max_val, unsigned char min, @@ -327,7 +330,7 @@ convert_u8_double_scaled (double min_val, void *dst, int src_pitch, int dst_pitch, - int n) + long n) { while (n--) { @@ -346,27 +349,28 @@ convert_u8_double_scaled (double min_val, dst += dst_pitch; src += src_pitch; } + return n; } #define MAKE_CONVERSIONS(name, min_val, max_val, min, max) \ -static void \ +static long \ convert_##name##_double (void *src, \ void *dst, \ int src_pitch, \ int dst_pitch, \ - int n) \ + long n) \ { \ - convert_u8_double_scaled (min_val, max_val, min, max, \ + return convert_u8_double_scaled (min_val, max_val, min, max, \ src, dst, src_pitch, dst_pitch, n); \ } \ -static void \ +static long \ convert_double_##name (void *src, \ void *dst, \ int src_pitch, \ int dst_pitch, \ - int n) \ + long n) \ { \ - convert_double_u8_scaled (min_val, max_val, min, max, \ + return convert_double_u8_scaled (min_val, max_val, min, max, \ src, dst, src_pitch, dst_pitch, n); \ } @@ -427,7 +431,7 @@ types_u8 (void) ); } -static inline void +static inline long convert_double_u16_scaled (double min_val, double max_val, unsigned short min, @@ -436,7 +440,7 @@ convert_double_u16_scaled (double min_val, void *dst, int src_pitch, int dst_pitch, - int n) + long n) { while (n--) { @@ -454,9 +458,10 @@ convert_double_u16_scaled (double min_val, dst += dst_pitch; src += src_pitch; } + return n; } -static inline void +static inline long convert_u16_double_scaled (double min_val, double max_val, unsigned short min, @@ -465,7 +470,7 @@ convert_u16_double_scaled (double min_val, void *dst, int src_pitch, int dst_pitch, - int n) + long n) { while (n--) { @@ -483,27 +488,28 @@ convert_u16_double_scaled (double min_val, dst += dst_pitch; src += src_pitch; } + return n; } #define MAKE_CONVERSIONS(name, min_val, max_val, min, max) \ -static void \ +static long \ convert_##name##_double (void *src, \ void *dst, \ int src_pitch, \ int dst_pitch, \ - int n) \ + long n) \ { \ - convert_u16_double_scaled (min_val, max_val, min, max, \ + return convert_u16_double_scaled (min_val, max_val, min, max, \ src, dst, src_pitch, dst_pitch, n);\ } \ -static void \ +static long \ convert_double_##name (void *src, \ void *dst, \ int src_pitch, \ int dst_pitch, \ - int n) \ + long n) \ { \ - convert_double_u16_scaled (min_val, max_val, min, max, \ + return convert_double_u16_scaled (min_val, max_val, min, max, \ src, dst, src_pitch, dst_pitch, n);\ } diff --git a/extensions/naive-CMYK.c b/extensions/naive-CMYK.c index 2eb39e6..7badb0d 100644 --- a/extensions/naive-CMYK.c +++ b/extensions/naive-CMYK.c @@ -23,20 +23,20 @@ #include "babl.h" #include "util.h" -static void rgb_to_cmyk (int src_bands, +static long rgb_to_cmyk (int src_bands, void **src, int *src_pitch, int dst_bands, void **dst, int *dst_pitch, - int n); -static void cmyk_to_rgb (int src_bands, + long n); +static long cmyk_to_rgb (int src_bands, void **src, int *src_pitch, int dst_bands, void **dst, int *dst_pitch, - int n); + long n); int init (void) { @@ -108,14 +108,14 @@ init (void) return 0; } -static void +static long rgb_to_cmyk (int src_bands, void **src, int *src_pitch, int dst_bands, void **dst, int *dst_pitch, - int n) + long n) { BABL_PLANAR_SANITY @@ -163,16 +163,17 @@ rgb_to_cmyk (int src_bands, BABL_PLANAR_STEP } + return n; } -static void +static long cmyk_to_rgb (int src_bands, void **src, int *src_pitch, int dst_bands, void **dst, int *dst_pitch, - int n) + long n) { BABL_PLANAR_SANITY @@ -209,5 +210,6 @@ cmyk_to_rgb (int src_bands, BABL_PLANAR_STEP } + return n; } diff --git a/tests/babl-html-dump.c b/tests/babl-html-dump.c index e26e5a7..d33aab5 100644 --- a/tests/babl-html-dump.c +++ b/tests/babl-html-dump.c @@ -17,8 +17,7 @@ * Boston, MA 02111-1307, USA. */ -#include "babl.h" -#include "babl-internal.h" /* for babl_log */ +#include "babl-internal.h" /* needed for babl_log */ static void model_html (Babl *babl); static void type_html (Babl *babl); diff --git a/tests/babl_class_name.c b/tests/babl_class_name.c index c011150..2b0a6a3 100644 --- a/tests/babl_class_name.c +++ b/tests/babl_class_name.c @@ -19,7 +19,6 @@ #include #include -#include "babl.h" #include "babl-internal.h" struct diff --git a/tests/grayscale_to_rgb.c b/tests/grayscale_to_rgb.c index cc2c48e..b3d06f2 100644 --- a/tests/grayscale_to_rgb.c +++ b/tests/grayscale_to_rgb.c @@ -17,7 +17,6 @@ * Boston, MA 02111-1307, USA. */ -#include "babl.h" #include "babl-internal.h" #define PIXELS 5 diff --git a/tests/introspect.c b/tests/introspect.c index 84ff384..26cbec9 100644 --- a/tests/introspect.c +++ b/tests/introspect.c @@ -17,7 +17,6 @@ * Boston, MA 02111-1307, USA. */ -#include "babl.h" #include "babl-internal.h" int diff --git a/tests/models.c b/tests/models.c index 557d680..9faf564 100644 --- a/tests/models.c +++ b/tests/models.c @@ -2,8 +2,7 @@ * RGBA data */ #include -#include "babl.h" -#include "math.h" +#include #include "babl-internal.h" int OK=1; diff --git a/tests/nop.c b/tests/nop.c index bdf6fde..ecc44a6 100644 --- a/tests/nop.c +++ b/tests/nop.c @@ -18,7 +18,6 @@ */ #include "babl.h" -#include "babl-internal.h" int main (int argc, diff --git a/tests/rgb_to_bgr.c b/tests/rgb_to_bgr.c index 2f0d395..e424642 100644 --- a/tests/rgb_to_bgr.c +++ b/tests/rgb_to_bgr.c @@ -19,7 +19,6 @@ #include -#include "babl.h" #include "babl-internal.h" #define PIXELS 3 diff --git a/tests/rgb_to_ycbcr.c b/tests/rgb_to_ycbcr.c index e07d1b0..a2f8d36 100644 --- a/tests/rgb_to_ycbcr.c +++ b/tests/rgb_to_ycbcr.c @@ -19,7 +19,6 @@ #include -#include "babl.h" #include "babl-internal.h" #define PIXELS 6 diff --git a/tests/sanity.c b/tests/sanity.c index 6271492..3f734f6 100644 --- a/tests/sanity.c +++ b/tests/sanity.c @@ -17,8 +17,6 @@ * Boston, MA 02111-1307, USA. */ -#include "babl.h" -#include "babl-sanity.h" #include "babl-internal.h" int diff --git a/tests/srgb_to_lab_u8.c b/tests/srgb_to_lab_u8.c index 1b24b24..19b5c25 100644 --- a/tests/srgb_to_lab_u8.c +++ b/tests/srgb_to_lab_u8.c @@ -18,7 +18,6 @@ */ #include -#include "babl.h" #include "babl-internal.h" #define PIXELS 6 diff --git a/tests/types.c b/tests/types.c index c014414..8e76164 100644 --- a/tests/types.c +++ b/tests/types.c @@ -1,5 +1,4 @@ -#include "babl.h" -#include "math.h" +#include #include "babl-internal.h" int OK=1; -- 2.30.2